<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div>1</div>
		<div>2</div>
		<div>3</div>
		<div>4</div>
		<div>5</div>
		<div>6</div>
		<div>7</div>
		<div>8</div>
		<div>9</div>
		<div>10</div>
	</body>
	<script>
		/* 遇到某个地方跳过循环
		var allDiv = document.getElementsByTagName('div');
		for(var i = 0;i<= allDiv.length;i++){
			// 下标等于2的时候跳过循环
			if(i == 2){
				continue;
			}else{
				allDiv[i].style.background  = 'red';
			}
		}
		*/
		/* 1357不循环
		var allDiv = document.getElementsByTagName('div');
		for(var i = 0;i<= allDiv.length;i++){
			if(i % 2 == 0){
				continue;
			}else{
				allDiv[i].style.background  = 'red';
			}
		}
		*/
		/* 循环到下标为8的时候停止循环
	   var allDiv = document.getElementsByTagName('div');
	   for(var i = 0;i<= allDiv.length;i++){
		   if(i == 8){
			   break;
		   }else{
			   allDiv[i].style.background  = 'red';
		   }K
	   }
	   */
		var allDiv = document.getElementsByTagName('div');
		var i = 0;
		while (i < allDiv.length) {
			if (i % 2 == 0) {
				i++;
				console.log(i)
				continue;
			}else {
				allDiv[i].style.background = 'red';
			}
			i++;
		}
	</script>
</html>